package com.woniu.bank.controller;

import com.github.pagehelper.PageInfo;
import com.woniu.bank.dto.DscDTO;
import com.woniu.bank.dto.DspDTO;
import com.woniu.bank.dto.FarmerLoanSheetDTO;
import com.woniu.bank.service.DspService;
import com.woniu.bank.service.FarmerLoanSheetService;
import com.woniu.bank.util.Result;
import com.woniu.bank.vo.FarmerLoanSheetVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：lgy
 * @description：TODO
 * @date ：2023/1/5 17:08
 */
@RestController
@RequestMapping("dsps")
@Api(tags = "待审批页面",description = "待审批页面")
public class DspController {
    @Autowired
    private FarmerLoanSheetService farmerLoanSheetService;
    @Autowired
    private DspService dspService;

    @ApiOperation(value = "模糊查询待审批页面全部业务",notes ="模糊查询待审批页面全部业务，可以根据页面选项模糊查询",httpMethod="POST")
    @PostMapping("selDsp")
    public Result selDsp(@RequestBody FarmerLoanSheetDTO farmerLoanSheetDTO){
        List<FarmerLoanSheetVO> farmerLoanSheetVOS = farmerLoanSheetService.selectDspByFlsDTO(farmerLoanSheetDTO);
        PageInfo<FarmerLoanSheetVO> carpayVOPageInfo = new PageInfo<>(farmerLoanSheetVOS);
        return Result.ok().data("flsVos",carpayVOPageInfo);
    }
    @ApiOperation(value = "更改业务状态",notes ="更改业务状态，选择通过或者驳回",httpMethod="POST")
    @PostMapping("updateDsp")
    public Result updateDsp(@RequestBody DspDTO dspDTO){
        int i = dspService.updateDsp(dspDTO);
        return i==1?Result.ok():Result.error();
    }
}
